package com.java1234.dao;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;

import com.java1234.model.Manager;

public class managerDao {

	public Manager login(Connection con,Manager manager)throws Exception{
		Manager resultUser=null;
		String sql="select * from db_book.dbo.t_manager where managerName=? and managerPassword=?";
		PreparedStatement pstmt=con.prepareStatement(sql);
		pstmt.setString(1,manager.getUserName());
		pstmt.setString(2, manager.getPassword());
		ResultSet rs=pstmt.executeQuery();
		if(rs.next()) {
			resultUser=new Manager();
			resultUser.setUserName(rs.getString("managerName"));
			resultUser.setPassword(rs.getString("managerPassword"));
		}
		return resultUser;
	}
}
